﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LikeUs.WebService.Client;
using LikeUs.WebService.Client.WSInfoClient;
using System.Web.Security;

namespace LikeUsWebSite
{
    public partial class Profile : System.Web.UI.Page
    {
        protected UserData userData;
        protected void Page_Load(object sender, EventArgs e)
        {
            getUserInfo();
        }

        protected void getUserInfo()
        {
            WSInfoProxy wsProxy = new WSInfoProxy();
            //mydata = wsProxy.GetMyUser(Page.User.Identity.Name);
            userData = (UserData)Session["userData"];
            userName.Text = userData.Name1;
            userMail.Text = userData.Email;
            myImage.ImageUrl = userData.Image;
            if (myImage.ImageUrl=="")
                myImage.ImageUrl = "./Images/likeus2.jpg";
            userComment.Text = userData.RequestedDistance.ToString();
            if (Session["AccessToken"]==null)
                typeImg.ImageUrl = "./Images/likeus2.jpg";
            else
                typeImg.ImageUrl = "./Images/Facebook.png";
        }

     
        protected void Button5_Click(object sender, EventArgs e)
        {
            WSInfoProxy wsProxy = new WSInfoProxy();
            wsProxy.DeleteUserAccount(userData.UserID);
            Session.Abandon();
            Session.Clear();
            FormsAuthentication.SignOut();
            Response.Redirect("./Default.aspx");
        }
    }
}
